package com.superteam.zzl.Des;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.superteam.zzl.activity.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/1/12.
 */
public class GvAdapter extends BaseAdapter{
    private Context context;
    private List<Integer> list;
    private List<String> strings;

    public GvAdapter(Context context, List<Integer> list) {
        this.context = context;
        this.list = list;
        strings=new ArrayList<>();
        strings.add("必体验");
        strings.add("美食");
        strings.add("景点");
        strings.add("当地体验");
        strings.add("即时翻译");
        strings.add("当地天气");
        strings.add("汇换速率");
        strings.add("时间");
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView iv;
        TextView tv;
        convertView=View.inflate(context,R.layout.gvitem,null);
        iv=(ImageView)convertView.findViewById(R.id.gviv);
        tv=(TextView) convertView.findViewById(R.id.gvtv);
        iv.setImageResource(list.get(position));
        tv.setText(strings.get(position));
        return convertView;
    }
}
